package edu.spec.student.model;

import edu.spec.basic.model.User;

import javax.persistence.*;
import java.util.Date;

/**
 * "主任信箱"实体类
 */
@Entity
@Table(name = "t_message")
public class Message {

    // 主键
    private Integer id;
    // 值为null，表示是楼主。有值说明是下面的回复或者，其值为楼主的主键
    private Message parent;
    // 标题
    private String title;
    // 关键词
    private String keywords;
    /**
     * 信息分类
     * 1 学习
     * 2 生活
     * 3 考试
     * 4 烦恼
     */
    private Integer classify;
    // 写信的学生
    private Student student;
    // 回复的主任
    private User director;
    // 学生反馈信息内容
    private String studentMessage;
    // 反馈时间
    private Date messageDate;
    // 回复正文
    private String directorResponse;
    // 回复时间
    private Date responseDate;
    // 学生是否更新，0代表未更新，1代表已经更新
    private Integer ifStudentUpdate;
    // 主任是否更新，0代表未更新，1代表已经更新
    private Integer ifDirectorUpdate;

    @Id
    @GeneratedValue
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getKeywords() {
        return keywords;
    }

    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }

    public Integer getClassify() {
        return classify;
    }

    public void setClassify(Integer classify) {
        this.classify = classify;
    }

    @Column(name = "message_date")
    public Date getMessageDate() {
        return messageDate;
    }

    public void setMessageDate(Date messageDate) {
        this.messageDate = messageDate;
    }

    @Column(name = "response_date")
    public Date getResponseDate() {
        return responseDate;
    }

    public void setResponseDate(Date responseDate) {
        this.responseDate = responseDate;
    }

    @ManyToOne
    @JoinColumn(name = "parent_id")
    public Message getParent() {
        return parent;
    }

    public void setParent(Message parent) {
        this.parent = parent;
    }

    @ManyToOne
    @JoinColumn(name = "student_id")
    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    @ManyToOne
    @JoinColumn(name = "user_id")
    public User getDirector() {
        return director;
    }

    public void setDirector(User director) {
        this.director = director;
    }

    @Column(name = "student_message")
    public String getStudentMessage() {
        return studentMessage;
    }

    public void setStudentMessage(String studentMessage) {
        this.studentMessage = studentMessage;
    }

    @Column(name = "director_response")
    public String getDirectorResponse() {
        return directorResponse;
    }

    public void setDirectorResponse(String directorResponse) {
        this.directorResponse = directorResponse;
    }

    @Column(name = "if_student_update")
    public Integer getIfStudentUpdate() {
        return ifStudentUpdate;
    }

    public void setIfStudentUpdate(Integer ifStudentUpdate) {
        this.ifStudentUpdate = ifStudentUpdate;
    }

    @Column(name = "if_director_update")
    public Integer getIfDirectorUpdate() {
        return ifDirectorUpdate;
    }

    public void setIfDirectorUpdate(Integer ifDirectorUpdate) {
        this.ifDirectorUpdate = ifDirectorUpdate;
    }

    public Message() {
    }
}
